<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<div class="modal-dialog ms-modal-dialog" style="margin-top:50px;" >
  <div class="modal-content" style="width:130%">
     
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
      <h4 class="modal-title">学员成绩录入-${projectPhase.project.name}-第<c:out value="${projectPhase.phase}"/>期</h4>
    </div>
      <form class="form-horizontal ms-form form-personal-info" method="POST" action="${ctx.host}/project-results/${projectPhase.id}/trainee-score-list" data-validate="true">
        
        <input type="hidden" name="_method" value="PATCH" />
        
        <input type="hidden" name="projectPhaseId" value="${projectPhase.id}" />
        
         <div class="modal-body">
             
			<table class="table table-hover umu-table tab-pane table-striped">
		        <thead>
		          <tr>
					<th>姓名</th>
					<th>学员邮箱</th>
					<th class="text-center">成绩</th>
					<th class="text-center">缺勤</th>
					<th class="text-center">是否补考</th>
					<c:if test="${projectPhase.phase==projectPhase.project.phaseCount }">
					<th class="text-center">是否结业</th>
					</c:if>
					<th class="text-center">备注</th>
		          </tr>
		        </thead>
		        
		        <tbody>
					<c:forEach items="${projectTrainees}" var="projectTrainee">
			            <tr>
			              <input type="hidden" value = "${projectTrainee.trainee.id}" name ="traineeIds" />
			              <td nowrap>${projectTrainee.trainee.name}</td>
			              <td>${projectTrainee.trainee.email}</td>
			              <td class="text-center" nowrap>
						  	<input type="text" class="form-control" style="width:85px" data-validate="number|min,0|max,100" name="score" placeholder="成绩" value="${trainingResults[projectTrainee.trainee.id].score}">
						  </td>
						  <td>
						  	<input type="text" class="form-control" style="width:85px" data-validate="number" name="absence" placeholder="缺勤天数" value="${trainingResults[projectTrainee.trainee.id].absence}">
						  </td>
						  <td>
						  	<input type="checkbox" name="resitTraineeIds" value="${projectTrainee.trainee.id}" <c:if test="${trainingResults[projectTrainee.trainee.id].resit !=null &&  trainingResults[projectTrainee.trainee.id].resit ==true }">checked</c:if>/>
						  </td>
						  <c:choose>
						  <c:when test="${projectPhase.phase==projectPhase.project.phaseCount }">
						  <td>
						  	<input type="checkbox" name="completeTraineeIds" value="${projectTrainee.trainee.id}" <c:if test="${projectTrainee.complete }">checked</c:if>/>
						  </td>
						  </c:when>
						  <c:otherwise>
						  	<input type="hidden" name="completeTraineeIds" value="" />
						  </c:otherwise>
						  </c:choose>
						  <td>
						  	<input type="text" name="comment" value="${trainingResults[projectTrainee.trainee.id].comment}" />
						  </td>
			            </tr>
			        </c:forEach>		        
		        </tbody>
		        <input type="hidden" name="completeTraineeIds" value="" />
		        <input type="hidden" name="resitTraineeIds" value="" />
		
		      </table>      
        </div>

      <div class="modal-footer">
        <button type="submit" class="btn btn-shadow-success btn-shadow umu-btn" data-dismiss="modal">确定</button>
        <button type="button" class="btn btn-shadow-default btn-shadow umu-btn" data-dismiss="modal">取消</button>
      </div>
      </form>
    
  </div>
</div>